import heapq

h = []
data = [5, 9, 1, 4, 3, 2, 8, 7, 6]

for i in data:
    heapq.heappush(h, i)

print(h)
""" 结果
     1, 
    3, 2, 
  6, 4, 5, 8, 
9, 7
"""

print(f"min: {min(h)}, max: {max(h)}")
print(f"min: {heapq.nsmallest(1, h)[0]}, max: {heapq.nlargest(1, h)[0]}")
